﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace 计科201518彭康
{
    public partial class 实验3_11 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            DataClasses1DataContext db = new DataClasses1DataContext();
            var results = from r in db.Table_2
                          select r;
            GridView1.DataSource = results;
            GridView1.DataBind();
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            DataClasses1DataContext db = new DataClasses1DataContext();
            var results = from r in db.Table_2 
                          where System.Data.Linq.SqlClient.SqlMethods.Like(r.姓名, $"%{TextBox1.Text}%")
                          select r;
            GridView1.DataSource = results;
            GridView1.DataBind();
        }
    }
}